#ifndef _HELIX_IMAGE_FACTORY_H_
#define _HELIX_IMAGE_FACTORY_H_

#include "../../Helix.h"
#include "../../HObject.h"
#include "Image.h"
#include <string>

using namespace std;

namespace helix
{

	/**
	*	This class is a factory that loads and creates image objects
	*	\todo Make this class a singleton.
	*/
	class MY_CLASS ImageFactory : public HObject
	{
	protected:

	public:
		/**
		*	Default constructor instantiates the factory object.  This probably needs to be made
		*	private because it should be a singleton.  In any case, there is no stored state in this
		*	class, so not much point in instantiating an object.
		*/
		ImageFactory();

		/**
		*	Default deconstructor.	
		*/
		virtual ~ImageFactory();

		/**
		*	Static factory method for loading an image from a file.  Specify a file name and
		*	it will look at the extension to determine what kind of image file it is.  If the
		*	image type is supported, it will return an Image object
		*	\param fileName a c style string that specifies the location and name of the image to load.
		*	\return A pointer to a valid Image object if it was found and could be loaded.  Null otherwise.  
		*	This Image object can be freed with a call to ImageFactory::deleteImage.  It is not recommended
		*	to delete Images loaded by explicitly calling delete.  This will cause problems with the way 
		*	the ImageFactory keeps track of Images in the future.  
		*/
		static Image *loadImage(const char* fileName);


		/**
		*	Cleanup method for releasing Image objects that were instantiated by the factory.  Can successfully
		*	delete any Image returned from ImageFactory::loadImage
		*	\param image The Image object to delete.
		*/
		static void deleteImage(Image *image);
	};


}

#endif


